<?php
include_only();

if($page=="signin")
{
include "login.php";
$content_login_form = load_content_template("login.tbl" ,"Sign In", $login_form);
}

if($page=="register")
{
include "register.php";
$content_register_form =  load_content_template("register.tbl" ,"register", $register_form);
}

if($page=="upload_video")
{
include "upload_video.php";
$content_upload_youtube_video = load_content_template("add_youtube_video.tbl" ,"Add Youtube Video", $upload_youtube_video);
$content_upload_remote_video = load_content_template("add_remote_video.tbl" ,"Add Remote Video", $upload_remote_video);
//$content_upload_local_video = load_content_template("Upload Video", $upload_local_video);
}

if($page=="video_uploader")
{
include "video_uploader.php";
$content_video_uploader = load_content_template("video_information.tbl" ,"Video Information", $video_uploader);
//include "upload_video.php";
//$content_upload_youtube_video = load_content_template("Add Youtube Video", $upload_youtube_video);
}

if($page=="upload_subtitle")
{
include "upload_subtitle.php";

$content_upload_subtitle_form = load_content_template("upload_subtitle_hint.tbl" ,"*hint", $upload_subtitle_hint);
$content_upload_subtitle_form = $content_upload_subtitle_form . load_content_template("upload_subtitle_form.tbl" ,"Upload Subtitle", $upload_subtitle_form);
$content_upload_subtitle_form = $content_upload_subtitle_form . load_content_template("upload_subtitle_text.tbl" ,"Import Subtitle", $import_subtitle_text);
}

if($page=="video_player")
{
require_once "video_player.php";
require_once "video_information.php";
require_once "video_comments.php";
require_once "subtitle.php";

$content_video_player = load_content_template("video_player.tbl", "Video Player", $video_player);
$content_video_info = load_content_template("video_info.tbl", "Video Information", $video_info);
$content_video_comments = load_content_template("video_comments.tbl", "Comments", $video_comments);
}

if($page=="subtitle")
{
require_once "include/config.php";
require_once "include/functions.php";
require_once "jwplayer.php";
require_once "subtitle.php";
require_once "subtitle_tools.php";
require_once "subtitle_info.php";
require_once "editor_playinfo.php";

$info = get_video_file_and_table_name($subtitle_id);
$subtitle_video_file_name = $info['video_file_name'];
if($subtitle_video_file_name==''){$subtitle_video_file_name='no-video.gif';}
$subtitle_table_name = $info['subtitle_table_name'];
$video_player_window = video_player( $subtitle_video_file_name , $subtitle_table_name);

$content_video_player_window = load_content_template("video_player.tbl" ,"Video Player", $video_player_window);
$content_video_player_info = load_content_template("editor_playinfo.tbl" ,"play info", $editor_playinfo);
$content_subtitle_page_content = load_content_template("subtitle_editor.tbl","Subtitle Editor", $subtitle_page_content);
$content_subtitle_page_info = load_content_template("subtitle_info.tbl","Subtitle Info", $subtitle_info);
$content_subtitle_page_tools = load_content_template("subtitle_tools.tbl","Subtitle Tools", $subtitle_tools);
}

if($page=="my_videos")
{
require_once "user_videos.php";
$content_user_videos = load_content_template("user_videos.tbl" ,"My Videos", $user_videos);
}

if($page=="my_subtitles")
{
require_once "user_subtitles.php";
$content_user_subtitles = load_content_template("user_subtitles.tbl" ,"My Subtitles", $user_subtitles);
}

if($page=='requests')
{
require_once "requests.php";
$content_requests = load_content_template("requests.tbl" ,"Open Requests", $requests);
}

if($page=='edit_subtitle_info')
{
require_once "edit_subtitle_info.php";
$content_edit_subtitle = load_content_template("edit_subtitle_info.tbl", "Edit Subtitle Info", $subtitle_info);
}

if($page=='edit_video_info')
{
require_once "edit_video_info.php";
$content_edit_video = load_content_template("edit_video_info.tbl", "Edit Video Info", $video_info);
}

if($page=='ucp')
{
require_once "usercp.php";
$content_control_panel = load_content_template("edit_account_info.tbl" ,"Edit Account Information", $control_panel);
}

if($page=='videos')
{
require_once "all_videos.php";
$content_all_videos = load_content_template("all_videos.tbl" ,"videos", $all_videos);
}

if($page=='finished_subtitles')
{
require_once "finished_subtitles.php";
$content_finished_subtitles = load_content_template("finished_subtitles.tbl","subtitles", $finished_subtitles);
}

if($page=='subtitle_info')
{
require_once "subtitle_info.php";
$content_subtitle_info = load_content_template("subtitle_info.tbl", "subtitle information", $subtitle_info);
$content_team_members = load_content_template("team_members.tbl","team members", $team_members);
$content_join_request = load_content_template("join_requests.tbl","join requests", $join_requests);
}

if($page=='search')
{
require_once "search.php";
$content_search = load_content_template("search.tbl" ,"search", $search);
}

if($page=='forget_password')
{
require_once "forget_password.php";
$content_forget_password = load_content_template("forget_password.tbl" ,"forget password", $forget_password);
}

if($page=='favourites')
{
require_once "favourites.php";
$content_favourites = load_content_template("favourites.tbl", "favourites", $favourites);
}

if(!empty($message))
{
$message_box = message_box("message", $message);
}

if(!empty($error_message) and $error_message!='')
{
$error_message = error_message("error", $error_message);
}

if(!empty($info_message) and $info_message!='')
{
$info_message = info_message("info", $info_message);
}

if($page=='my_requests')
{
require_once "my_requests.php";
$content_my_requests = load_content_template("my_requests.tbl", "My Requests", $my_requests);
}

if($page=='home')
{
	if(read_module_option('videos_slide', 'enable')=='1')
	{
	require_once "modules/new_videos.php";
	$slider_new_videos = $new_videos;
	}
	if(read_module_option('random_videos', 'enable')=='1')
	{
	require_once "modules/random_videos.php";
	$random_videos = load_content_template("random_videos.tbl", "Our Videos", $table_random_videos);
	}
	if(read_module_option('subtitles_in_process', 'enable')=='1')
	{
	require_once "modules/subtitles_in_process.php";
	$subtitles_in_process = load_content_template("subtitles_in_process.tbl", "Subtitles In Process", $subtitles_in_process);
	}

        require_once 'modules/main_video.php';
        $home_main_video = load_content_template("home_main_video.tbl", "Latest Video", $main_video);

if(empty($slider_new_videos)){$slider_new_videos = "";}
if(empty($web_page_content)){$web_page_content = "";}
if(empty($random_videos)){$random_videos = "";}
if(empty($subtitles_in_process)){$subtitles_in_process = "";}
if(empty($main_video)){$main_video = "";}
}

if(empty($web_page_content)){$web_page_content = "";}
if(!empty($message)) $web_page_content = $web_page_content . $message_box;
if(!empty($error_message)) $web_page_content = $web_page_content . $error_message;
if(!empty($info_message)) $web_page_content = $web_page_content . $info_message;


if(!empty($page)){
$web_page_content = "";
if($page=="signin") $web_page_content = $web_page_content . $content_login_form;
if($page=="register") $web_page_content = $web_page_content . $content_register_form;
if($page=="upload_video") $web_page_content = $web_page_content . $content_upload_youtube_video . $content_upload_remote_video /*. $content_upload_local_video*/;
if($page=="video_uploader") {$web_page_content = $web_page_content . $content_video_uploader;}
if($page=="upload_subtitle") $web_page_content = $web_page_content . $content_upload_subtitle_form;
if($page=="video_player"){$web_page_content = $web_page_content . $content_video_player . $content_video_info . $content_video_comments;}
if($page=="subtitle") {$web_page_content = $web_page_content . $content_video_player_window . $content_video_player_info . $content_subtitle_page_content . $content_subtitle_page_tools . $content_subtitle_page_info;}
if($page=="my_videos") $web_page_content = $web_page_content . $content_user_videos;
if($page=="my_subtitles") $web_page_content = $web_page_content . $content_user_subtitles;
if($page=='requests') $web_page_content = $web_page_content . $content_requests;
if($page=='edit_subtitle_info') $web_page_content = $web_page_content . $content_edit_subtitle;
if($page=='edit_video_info') $web_page_content = $web_page_content . $content_edit_video;
if($page=='ucp') $web_page_content = $web_page_content . $content_control_panel;
if($page=='videos') $web_page_content = $web_page_content . $content_all_videos;
if($page=='finished_subtitles') $web_page_content = $web_page_content . $content_finished_subtitles;
if($page=='subtitle_info') $web_page_content = $web_page_content . $content_subtitle_info . $content_team_members . $content_join_request;
if($page=='search') $web_page_content = $web_page_content . $content_search ;
if($page=='forget_password') $web_page_content = $web_page_content . $content_forget_password ;
if($page=='favourites') $web_page_content = $web_page_content . $content_favourites ;
if($page=='home') $web_page_content = $home_main_video . $slider_new_videos . $web_page_content . $random_videos . $subtitles_in_process ;
if($page=='my_requests') $web_page_content = $content_my_requests;

}


?>